<template>
  <div>
    <van-popup
        v-model="show"
        style="background: none"
        get-container="body"
        :close-on-click-overlay="false"
    >
      <div class="popup-box bg-blur" @click="11">
        <div class="title-box">
          <div class="title">
            {{ title }}
          </div>
          <van-icon name="cross" @click="close" class="cross"/>
        </div>
        <div class="content">
          <slot></slot>
          <div class="text" v-html="text"></div>
          <div class="bot">
            <div class="btn" @click="$emit('cancel')" v-show="cancelBtnShow">
              {{ cancelText || $t("page4.doc63") }}
            </div>
            <div class="btn active" @click="$emit('confirm')">
              {{ confirmText || $t("page4.doc64") }}
            </div>
          </div>
        </div>
      </div>
    </van-popup>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false
    },
    title: String,
    text: String,
    confirmText: String,
    cancelText: String,
    cancelBtnShow: {
      type: Boolean,
      default: true
    },

  },
  data() {
    return {};
  },
  computed: {
    show: {
      get() {
        return this.value;
      },
      set(value) {
        this.$emit('input', value);
      },
    },
  },
  methods: {
    close() {
      this.show = false;
      this.$emit('close');
    }
  },
};
</script>

<style scoped lang="less">
.popup-box {
  width: 6.4rem;
  //max-width: 96%;
  padding: .4rem;
  position: relative;
  border-radius: .24rem;
  line-height: 1.2;
  background: #131621;
  //backdrop-filter: blur(10px);
  .title-box {
    height: .48rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;

    .title {
      width: 82%;
      color: #fff;
      text-align: center;
      font-family: Sora;
      font-size: .32rem;
      font-style: normal;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      align-items: center;
      justify-content: center;

      img {
        width: .4rem;
        height: .4rem;
        margin-right: .12rem;
      }
    }

    .cross {
      margin-left: auto;
      font-size: .4rem;
      color: #fff;
      cursor: pointer;
    }
  }

  .content {
    border-radius: 0.4rem;
    padding: .4rem 0 0;
    //text-align: center;

    .text {
      color: #b7b7b7;
      font-size: 0.32rem;
    }

    .bot {
      margin-top: .4rem;
      display: flex;
      justify-content: space-between;
      gap: .32rem;

      .btn {
        min-height: 0.88rem;
        color: #fff;
        text-align: center;
        font-family: Sora;
        font-size: 0.28rem;
        font-style: normal;
        font-weight: 400;
        line-height: 0.36rem; /* 128.571% */
        display: flex;
        padding: 0.12rem 0.16rem;
        justify-content: center;
        align-items: center;
        gap: 0.2rem;
        flex: 1 0 0;
        border-radius: .48rem;
        border: .02rem solid #314cbb;
        background: #1b202d;
        //background: #1E212E;
        &.active {
          background: linear-gradient(90deg, #7B02FE 0%, #0570FD 100%);
          color: #fff;
          border-color: transparent;
        }
      }
    }
  }
}
</style>
